<template>
    <div>
        <el-card class="box-card">
            <div slot="header" style="text-align:left"></div>
            <el-tabs v-model="activeName" @tab-click="handleClick">
                <el-tab-pane label="企业信息" name="companyInfo">
                    <el-form ref="form" label-width="80px">
                        <el-form-item label="企业名称">
                             {{companyInfo.name}} 
                            
                        </el-form-item>
                       <el-form-item label="地区">
                            {{companyInfo.area}} 
                        </el-form-item>
                        <el-form-item label="地址">
                             {{companyInfo.address}} 
                        </el-form-item>
                        <el-form-item label="法人姓名">
                             {{companyInfo.legalPerson}} 
                        </el-form-item>
                        <el-form-item label="法人电话">
                             {{companyInfo.phone}} 
                        </el-form-item>
                         <el-form-item label="法人身份证">
                             {{companyInfo.idcard}} 
                        </el-form-item>
                         <el-form-item label="社会统一代码">
                             {{companyInfo.creditCode}} 
                        </el-form-item>
                           <el-form-item label="营业执照">
                             <img width="120px" height="120px" :src="companyInfo.creditCodeImage"/> 
                        </el-form-item>
                      </el-form>
                      <el-button type="primary">打印</el-button>
                      <el-button type="primary">导出</el-button>
                </el-tab-pane>
                <el-tab-pane label="开通应用" name="apps">
                      <el-table :data="apps" style="width: 100%">
                          <el-table-column prop="icon" label="logo" width="180">
                             <template slot-scope="scope">
                              <i v-if="scope.row.icon" class="el-icon-s-goods"></i>
                                <i v-else :class="scope.row.icon"></i>
                          </template>
                          </el-table-column>
                          <el-table-column
                            prop="name"
                            label="名称"
                            width="180">
                          </el-table-column>
                          <el-table-column
                            prop="code"
                            label="编码">
                          </el-table-column>
                          <el-table-column
                            prop="description"
                            label="描述">
                          </el-table-column>
                        </el-table>
                </el-tab-pane>
                <el-tab-pane label="Logo" name="third">logo</el-tab-pane>
            </el-tabs>
        </el-card>
    </div>
</template>

<script>
import {companyLoad,companyHasApp} from "@/request/api.js";
export default {
    data() {
        return {
            activeName: 'companyInfo',
            companyInfo:new Object(),
            apps:null
        };
    },
    methods: {
        handleClick(tab, event) {
            if(tab.name=="apps" && !this.apps){
              companyHasApp(this.$route.query.id).then((res) => {
                this.apps=res;
              })
            }
        }
    },
    mounted() {
       if(this.$route.query.id){
           companyLoad(this.$route.query.id).then((res) => {
                this.companyInfo=res;
                if(res.creditCodeImage){
                    this.companyInfo.creditCodeImage=this.$http.baseUrl + "/file/qiniu/" + res.creditCodeImage;             
                }
            })
       }
    }
};
</script>